package uk.ac.ncl.teach.ex.people;

/** 
 * UseLecturer - simple test class for the Lecturer class.
 *
 * @author Nick Cook &lt;nick.cook@ncl.ac.uk&gt;
 * @version $Revision: 1624 $<br />
 * $Date: 2011-01-17 12:20:26 +0000 (Mon, 17 Jan 2011) $<br />
 * Copyright (C) 2007 Newcastle University, UK
 */ 
public class UsePerson {

    /**
     * Demonstrate use of the Lecturer class.
     *
     * @param args arguments are ignored.
     */
    public static void main(String[] args) {
        Person mark = new Person("Mark Smith", 60);
        
        UniversityPerson jean  
            = new UniversityPerson("Jean Bacon", 60, 
                "Cambridge");
        
        Student bill = new Student("Bill Gates", 
            56, "Harvard", 3);
        
        Lecturer nick 
            = new Lecturer("Nick Cook", 50, "Newcastle",
            "Computing");
        
        printHierarchy(mark);
        printHierarchy(jean);
        printHierarchy(bill);
        printHierarchy(nick);
        
        /*
        System.out.println(bill.getName() 
            + " " + bill.getAge() 
            + ", " + bill.getInstitution()
            + " - " + bill.getStage());
   
        System.out.println(nick.getName() 
            + " " + nick.getAge() 
            + ", " + nick.getInstitution()
            + " - " + nick.getSchool());
        */
        
        // Can I do the following:
        // System.out.println(nick.getStage());
    }
    
    private static void printHierarchy(Person p) {
        System.out.println(p.getName() 
            + " is: " + p.getClass());
        
        System.out.println(p.getName() 
            + " is a Lecturer: " 
            + (p instanceof Lecturer));
        
        System.out.println(p.getName() 
            + " is a Student: " 
            + (p instanceof Student));
        
        System.out.println(p.getName() 
            + " is a UniversityPerson: " 
            + (p instanceof UniversityPerson));
        
        System.out.println(p.getName() 
            + " is a Person: " 
            + (p instanceof Person));
        
        System.out.println(p.getName() 
            + " is a Object: " 
            + (p instanceof Object));
    }
}    
